import java.awt.BorderLayout;
import java.awt.Color;

import javax.swing.BorderFactory;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JPanel;

public class CustomBarPanel extends JPanel {
	public ImageIcon icon;

	public JLabel gameName;
	public JLabel gameCards;
	public JLabel gameTimer;
	public JLabel gameRating;

	public Color c1, c2, c3, c4, c5, c6;

	public void on(String arg1, String arg2, int arg3, int arg4) {
		this.gameName.setText("   " + arg1);
		this.gameRating.setText("   " + arg3 + " - " + arg4);
		this.gameCards.setText(arg2 + " ");
		colorOn();
	}

	public void off() {
		this.gameName.setText("");
		this.gameRating.setText("");
		this.gameCards.setText("");
		colorOff();
	}

	public void set() {
		//inside background
		//border (top, left, bottom, right, color)
		
		
		this.setBackground(c1);
		this.setBorder(BorderFactory.createCompoundBorder(
				BorderFactory.createCompoundBorder(BorderFactory
						.createMatteBorder(1, 1, 1, 1, c2), BorderFactory
						.createMatteBorder(5, 0, 0, 5, c3)), BorderFactory
						.createMatteBorder(2, 0, 2, 2, c4)));
	}

	public void colorOn() {
		//c1 inside color
		//c2 border color
		Color ctmp = Color.white.darker();
		
		c1 = new Color(105, 105, 105);
		c2 = ctmp;
		c3 = ctmp;
		c4 = new Color(75, 75, 75);
		c5 = new Color(77, 77, 77);

		set();
	}

	public void colorOff() {
		Color ctmp = new Color(85, 85, 85);
		c1 = ctmp;
		c2 = ctmp;
		c3 = ctmp;
		c4 = ctmp;
		c5 = ctmp;

		set();
	}

	public CustomBarPanel() {
		colorOff();

		this.setBackground(c1);
		this.setLayout(new BorderLayout());
		this.setBorder(BorderFactory.createCompoundBorder(
				BorderFactory.createCompoundBorder(BorderFactory
						.createMatteBorder(2, 2, 0, 2, c2), BorderFactory
						.createMatteBorder(1, 1, 2, 2, c3)), BorderFactory
						.createMatteBorder(3, 3, 3, 3, c4)));

		gameRating = new JLabel("");
		gameRating.setForeground(Color.cyan);
		this.add(gameRating, BorderLayout.WEST);

		gameName = new JLabel("");
		gameName.setForeground(Color.white);
		this.add(gameName, BorderLayout.CENTER);

		gameCards = new JLabel();
		gameCards.setForeground(Color.yellow);
		this.add(gameCards, BorderLayout.EAST);

		this.addMouseListener(new java.awt.event.MouseAdapter() {
			public void mouseEntered(java.awt.event.MouseEvent evt) {
				setBackground(c5);
			}

			public void mouseExited(java.awt.event.MouseEvent evt) {
				setBackground(c1);
			}

			public void mouseClicked(java.awt.event.MouseEvent evt) {
			}
		});

	}

}
